From 5f8cbb69be187519af9ecee587d5152be1c00cc2 Mon Sep 17 00:00:00 2001 From: "kaf24@labyrinth.cl.cam.ac.uk" Date: Wed, 26 Feb 2003 17:34:25 +0000 Subject: [PATCH] bitkeeper revision 1.105 (3e5cfaa1sTwHu-8MSxs6PpY5y9101Q) network.c, dev.c: Add compiler barriers to ensure descriptor updates occur before index updates in network code. --- xen/net/dev.c | 4 ++++ .../arch/xeno/drivers/network/network.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/net/dev.c b/xen/net/dev.c index 25aa35fd78..0bf8125014 100644 --- a/xen/net/dev.c +++ b/xen/net/dev.c @@ -533,6 +533,7 @@ void deliver_packet(struct sk_buff *skb, net_vif_t *vif) skb->pf = g_pfn; inc_and_out: + smp_wmb(); /* updates must happen before releasing the descriptor. */ shadow_ring->rx_idx = RX_RING_INC(i); } @@ -681,6 +682,8 @@ static void tx_skb_release(struct sk_buff *skb) * mutual exclusion from do_IRQ(). */ + smp_wmb(); /* make sure any status updates occur before inc'ing tx_cons. */ + /* Skip over a sequence of bad descriptors, plus the first good one. */ do { idx = vif->shadow_ring->tx_cons; @@ -826,6 +829,7 @@ void update_shared_ring(void) if ( rx->flush_count == tlb_flush_count[smp_processor_id()] ) __flush_tlb(); + smp_wmb(); /* copy descriptor before inc'ing rx_cons */ shadow_ring->rx_cons = RX_RING_INC(shadow_ring->rx_cons); if ( shadow_ring->rx_cons == net_ring->rx_event ) diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c index 8e742007cf..c9acaf43ee 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c @@ -293,7 +293,7 @@ static void network_rx_int(int irq, void *dev_id, struct pt_regs *ptregs) { if (np->net_ring->rx_ring[i].status != RING_STATUS_OK) { - printk("bad buffer on RX ring!(%d)\n", + printk(KERN_ALERT "bad buffer on RX ring!(%d)\n", np->net_ring->rx_ring[i].status); continue; } -- 2.30.2